﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ContentList.aspx.cs" Inherits="Manage_Cms_ContentList" %>

<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="KeRui.BLL" %>
<html>
<head>
    <!--#include file="../js/html_head.inc"-->
    <link rel="stylesheet" type="text/css" href="../Themes/<%=ManageHelper.GetTheme()%>/style.css" />

    <script type="text/javascript">
        function deletecontent(contentid)
        {
            if(confirm("确定删除该条内容吗？相关数据将一起删除！"))
            {
                var istop=document.getElementById("chk1").checked?1:0;
                var isrecommend=document.getElementById("chk2").checked?1:0;
                var ishot=document.getElementById("chk3").checked?1:0;
                var ismarked=document.getElementById("chk4").checked?1:0;
            
                var pageurl='&scontentid='+$("#txtsContentID").val()+'&title='+$("#txtsTitle").val()+'&istop='+istop+'&isrecommend='+isrecommend +'&ishot='+ishot +'&ismarked='+ismarked+'&cs=<%=KeRui.Common.PageRequest.GetInt("cs",-1) %>';
                window.location.href='ContentList.aspx?act=delete&contentid='+contentid+'&siteid=<% =KeRui.Common.PageRequest.GetInt("siteid",-1)%>&nodeid=<%=nodeID %>&datatype=<% =KeRui.Common.PageRequest.GetString("datatype")%>'+pageurl;
            }
        }
        
         function checkcontent(contentid)
        {
            if(confirm("确定审核通过该条内容吗？"))
            {
                var istop=document.getElementById("chk1").checked?1:0;
                var isrecommend=document.getElementById("chk2").checked?1:0;
                var ishot=document.getElementById("chk3").checked?1:0;
                var ismarked=document.getElementById("chk4").checked?1:0;
                
                var pageurl='&scontentid='+$("#txtsContentID").val()+'&title='+$("#txtsTitle").val()+'&istop='+istop+'&isrecommend='+isrecommend +'&ishot='+ishot +'&ismarked='+ismarked+'&cs=<%=KeRui.Common.PageRequest.GetInt("cs",-1) %>';
                window.location.href='ContentList.aspx?act=check&contentid='+contentid+'&siteid=<% =KeRui.Common.PageRequest.GetInt("siteid",-1)%>&nodeid=<%=nodeID %>&datatype=<% =KeRui.Common.PageRequest.GetString("datatype")%>'+pageurl;
            }
        }
        
        function restorecontent(contentid)
        {
            if(confirm("确定还原该条内容吗？"))
            {
                var istop=document.getElementById("chk1").checked?1:0;
                var isrecommend=document.getElementById("chk2").checked?1:0;
                var ishot=document.getElementById("chk3").checked?1:0;
                var ismarked=document.getElementById("chk4").checked?1:0;
            
                var pageurl='&scontentid='+$("#txtsContentID").val()+'&title='+$("#txtsTitle").val()+'&istop='+istop+'&isrecommend='+isrecommend +'&ishot='+ishot +'&ismarked='+ismarked+'&cs=<%=KeRui.Common.PageRequest.GetInt("cs",-1) %>';
                window.location.href='ContentList.aspx?act=restore&contentid='+contentid+'&siteid=<% =KeRui.Common.PageRequest.GetInt("siteid",-1)%>&nodeid=<%=nodeID %>&datatype=<% =KeRui.Common.PageRequest.GetString("datatype")%>'+pageurl;
            }
        }
        
        function searchcontent()
        {
            var istop=document.getElementById("chk1").checked?1:0;
            var isrecommend=document.getElementById("chk2").checked?1:0;
            var ishot=document.getElementById("chk3").checked?1:0;
            var ismarked=document.getElementById("chk4").checked?1:0;
            var isall=document.getElementById("chk5").checked?1:0;
            
            window.location.href='ContentList.aspx?act=search&scontentid='+$("#txtsContentID").val()+'&title='+$("#txtsTitle").val()
            +'&istop='+istop+'&isrecommend='+isrecommend +'&ishot='+ishot +'&ismarked='+ismarked+'&isall='+isall
            +'&cs=<%=KeRui.Common.PageRequest.GetInt("cs",-1) %>&siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1)%>&nodeid=<%=nodeID %>&datatype=<% =KeRui.Common.PageRequest.GetString("datatype")%>';
        }
        
//HYC
            function deleteAll()
            {
                if(confirm("确定删除该条内容吗？相关数据将一起删除！"))
                {     
                    var istop=document.getElementById("chk1").checked?1:0;
                    var isrecommend=document.getElementById("chk2").checked?1:0;
                    var ishot=document.getElementById("chk3").checked?1:0;
                    var ismarked=document.getElementById("chk4").checked?1:0;
            
                    var pageurl='&scontentid='+$("#txtsContentID").val()+'&title='+$("#txtsTitle").val()+'&istop='+istop+'&isrecommend='+isrecommend +'&ishot='+ishot +'&ismarked='+ismarked+'&cs=<%=KeRui.Common.PageRequest.GetInt("cs",-1) %>';
                
                    window.location.href='ContentList.aspx?act=deletenodeall&siteid=<% =KeRui.Common.PageRequest.GetInt("siteid",-1)%>&nodeid=<%=nodeID %>&datatype=<% =KeRui.Common.PageRequest.GetString("datatype")%>'+pageurl;
                
                }
            }
            function checkAll()
            {
                var   ingc;   
                for   (ingc=0;ingc<document.all.length;ingc++)   
                {   
                    if   (document.all(ingc).name   ==   'checkbox')     
                    {   
                          document.all(ingc).checked=true;
                    }   
                 } 
            }
            function checknono()
            {
                var   ing;   
                for   (ing=0;ing<document.all.length;ing++)   
                {   
                    if   (document.all(ing).name   ==   'checkbox')     
                    {   
                          document.all(ing).checked =   false;
                    }   
                 } 
            }
            function checkother()
            {
                var   ingf;   
                for   (ingf=0;ingf<document.all.length;ingf++)   
                {   
                    if   (document.all(ingf).name   ==   'checkbox')     
                    {                       
                          if(document.all(ingf).checked ==  false)
                          {
                                document.all(ingf).checked  =   true;
                          }
                          else
                          {
                                document.all(ingf).checked  =   false;
                          }
                    }   
                 } 
            }
            function deleteCheck()
            {
                var contentids="";
                 var   i;   
                    for   (i=0;i<document.all.length;i++)   
                    {   
                        if   (document.all(i).name   ==   'checkbox')     
                        {                       
                            if(document.all(i).checked   ==  true)
                            {
                                contentids=contentids+document.all(i).id+",";
                            }
                        }   
                     }
                     if(contentids=="")
                     {
                        alert("您还未选择要删除的信息！");
                        return false;
                     }
                    if(confirm("确定删除这些内容吗？相关数据将一起删除！"))
                    {     
                    var istop=document.getElementById("chk1").checked?1:0;
                    var isrecommend=document.getElementById("chk2").checked?1:0;
                    var ishot=document.getElementById("chk3").checked?1:0;
                    var ismarked=document.getElementById("chk4").checked?1:0;
                
                    var pageurl='&scontentid='+$("#txtsContentID").val()+'&title='+$("#txtsTitle").val()+'&istop='+istop+'&isrecommend='+isrecommend +'&ishot='+ishot +'&ismarked='+ismarked+'&cs=<%=KeRui.Common.PageRequest.GetInt("cs",-1) %>';
                    
                    window.location.href='ContentList.aspx?act=deleteMore&ContentIDs='+contentids+'&siteid=<% =KeRui.Common.PageRequest.GetInt("siteid",-1)%>&nodeid=<%=nodeID %>&datatype=<% =KeRui.Common.PageRequest.GetString("datatype")%>'+pageurl;
                    
                    }
            }
            function moveCheck()
            {
                var contentids="";
                var  i;   
                for   (i=0;i<document.all.length;i++)   
                {   
                    if   (document.all(i).name   ==   'checkbox')     
                    {                       
                        if(document.all(i).checked   ==  true)
                        {
                            contentids=contentids+document.all(i).id+",";
                        }
                    }   
                 }             
                 if(contentids=="")
                 {
                    alert("您还未选择要迁移的信息！");
                    return false;
                 }
                  if(confirm("确定迁移这些内容吗？相关数据将一起迁移！"))
                  { 
                        window.location.href='ContentMove.aspx?acttype=move&contentids='+contentids+'&siteid=<% =SiteID%>&nodeid=<%=nodeID %>';
                  }
            }
            function moveAll()
            {
                  if(confirm("确定迁移这些内容吗？相关数据将一起迁移！"))
                  { 
                        window.location.href='ContentMove.aspx?acttype=move&nodeid=<%=nodeID %>&siteid=<% =SiteID%>';
                  }          
            }
            function copyCheck()
            {
                var contentids="";
                var  i;   
                for   (i=0;i<document.all.length;i++)   
                {   
                    if   (document.all(i).name   ==   'checkbox')     
                    {                       
                        if(document.all(i).checked   ==  true)
                        {
                            contentids=contentids+document.all(i).id+",";
                        }
                    }   
                 }             
                 if(contentids=="")
                 {
                    alert("您还未选择要复制的信息！");
                    return false;
                 }
                  if(confirm("确定复制这些内容吗？"))
                  { 
                        window.location.href='ContentMove.aspx?acttype=copy&contentids='+contentids+'&siteid=<%=SiteID%>&nodeid=<%=nodeID %>';
                  }
            }
    </script>

</head>
<body>
    <%=ManageHelper.PageSucMsg()!=""?"<div class='msg_succeed'>"+ManageHelper.PageSucMsg()+"</div>":""%>
    <div class="column">
        <div class="columntitle">
            <%=navName%>
        </div>
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tbody>
                <tr class="summary-title" align="left">
                    <td align="left" style="padding-left: 10px;">
                        <a href="ContentItem.aspx?siteid=<% =KeRui.Common.PageRequest.GetInt("siteid",-1)%>&nodeid=<%=nodeID %>">
                            <img style="margin-right: 3px" src="/Manage/Pic/Icons/add.gif" align="absMiddle" />添加内容</a>
                    </td>
                </tr>
            </tbody>
        </table>
        <!--搜索开始-->
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tbody>
                <tr class="summary-title" align="left">
                    <td align="left" style="padding-left: 10px;">
                        <img style="margin-right: 3px" src="/Manage/Pic/Icons/search.gif" align="absMiddle" />搜索
                        文章ID：
                        <input value="<%=ContentID>1?ContentID.ToString():"" %>" type="text" class="colorblur"
                            id="txtsContentID" onfocus="this.className='colorfocus';" onblur="this.className='colorblur';"
                            style="width: 60px;" />
                        标题：
                        <input value="<%=Title %>" type="text" id="txtsTitle" class="colorblur" onfocus="this.className='colorfocus';"
                            onblur="this.className='colorblur';" style="width: 100px;" /><input type="checkbox"
                                value="0" id="chk1" name="chktypes" <%= IsTop==1?"checked":"" %> /><label for="chk1">置顶</label><input
                                    type="checkbox" value="0" id="chk2" name="chktypes" <%= IsRecommend==1?"checked":"" %> /><label
                                        for="chk2">推荐</label><input type="checkbox" id="chk3" value="0" name="chktypes" <%= IsHot==1?"checked":"" %> /><label
                                            for="chk3">热点</label><input type="checkbox" id="chk4" value="0" name="chktypes" <%= IsMarked==1?"checked":"" %> /><label
                                                for="chk4">醒目</label><input type="checkbox" id="chk5" value="0" name="chktypes" <%= IsAll==1?"checked":"" %> /><label
                                                    for="chk5">全文检索</label></td>
                    <td align="left" style="padding-top: 5px;">
                        <input align="absbottom" type="submit" value="搜索" class="button" onclick="searchcontent()" /></td>
                </tr>
            </tbody>
        </table>
        <!--搜索结束-->
        <table id="dlContents" cellspacing="1" cellpadding="1" align="center" border="0"
            style="width: 100%;">
            <tr>
                <td>
                    <tr class="summary-title" style="height: 25px;">
                        <td align="center">
                            &nbsp;时间</td>
                        <td>
                            &nbsp;内容标题(点击查看)</td>
                        <td align="Center">
                            &nbsp;置顶</td>
                        <td align="Center">
                            &nbsp;推荐</td>
                        <td align="Center">
                            &nbsp;热点</td>
                        <td align="Center">
                            &nbsp;醒目</td>
                        <td align="Center">
                            &nbsp;审核</td>
                        <td align="Center">
                            &nbsp;</td>
                        <td align="Center">
                            &nbsp;</td>
                        <td align="Center">
                            &nbsp;</td>
                        <td align="Center">
                            &nbsp;</td>
                        <%--<td align="Center" style="width: 20px;">
                            <input type="checkbox" onclick=""></td>--%>
                    </tr>
                </td>
            </tr>
            <tr>
                <td>
                    <%
                        
                        foreach (KeRui.Model.CmsContent model in listCmsContent)
                        {
                    %>
                    <tr class="tdbg" onmouseover="this.className='tdbg-dark';" onmouseout="this.className='tdbg';"
                        style="height: 25px;">
                        <td align="left">
                            <input type="checkbox" id="<%=model.ContentID %>" name="checkbox" />
                            <%=model.CreateTime.Month+"-"+model.CreateTime.Day+" "+model.CreateTime.Hour+":"+model.CreateTime.Minute %>
                        </td>
                        <td>
                            <a href='/aspx/redirect.aspx?contentid=<%=model.ContentID %>' target='blank'>
                                <%=hText(model.Title,Title)%>
                            </a>
                            <%=model.ContentType==1?"&nbsp;<img src=\"\\Manage\\Pic\\icon\\Img.gif\" alt=\"图片\" align=\"absmiddle\" />":"" %>
                            <%=model.IsRecommend?"&nbsp;<img src=\"\\Manage\\Pic\\icon\\recommend.gif\" alt=\"推荐\" align=\"absmiddle\" />":"" %>
                            <%=model.IsHot?"&nbsp;<img src=\"\\Manage\\Pic\\icon\\hot.gif\" alt=\"热点\" align=\"absmiddle\" />":"" %>
                            <%=model.IsTop?"&nbsp;<img src=\"\\Manage\\Pic\\icon\\top.gif\" alt=\"置顶\" align=\"absmiddle\" />":"" %>
                        </td>
                        <td align="Center">
                            <a href="javascript:void(0)" id="istop<%=model.ContentID %>" onclick="Content_Top(<%=model.ContentID %>);return false;">
                                <%=model.IsTop ? "取消置顶" : "置顶"%>
                            </a>
                        </td>
                        <td align="Center">
                            <a id="isrecommend<%=model.ContentID %>" href="javascript:void(0)" onclick="Content_Recommend(<%=model.ContentID %>);return false;">
                                <%=model.IsRecommend ? "取消推荐" : "推荐"%>
                            </a>
                        </td>
                        <td align="Center">
                            <a id="ishot<%=model.ContentID %>" href="javascript:void(0)" onclick="Content_Hot(<%=model.ContentID %>);return false;">
                                <%=model.IsHot ? "取消热点" : "热点"%>
                            </a>
                        </td>
                        <td align="Center">
                            <a id="ismarked<%=model.ContentID %>" href="javascript:void(0)" onclick="Content_Marked(<%=model.ContentID %>);return false;">
                                <%=model.IsMarked ? "取消醒目" : "醒目"%>
                            </a>
                        </td>
                        <td align="Center">
                            <%=model.ContentState == 2 ? "<img src='/Manage/Pic/icon/right.gif' alt='审核成功'>" : "<img src='/Manage/Pic/icon/wrong.gif' alt='未审核'>"%>
                        </td>
                        <td align="Center">
                            <a <%=model.ContentState == 2 ?"disabled='disabled'":""%> href="javascript:void(0)"
                                onclick="<%=model.ContentState == 2 ?"":"checkcontent("+model.ContentID+")"%>;return false; ">
                                审核</a>
                        </td>
                        <td align="Center">
                            <%--<a href="javascript:void(0)" target="_blank" onclick="window.location.href='ContentItem.aspx?contentid=<%=model.ContentID %>&nodeid=<%=KeRui.Common.PageRequest.GetInt("nodeid",-1) %>&siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1) %>';return false;">
                                    编辑</a>--%>
                            <a href="ContentItem.aspx?contentid=<%=model.ContentID %>&nodeid=<%=KeRui.Common.PageRequest.GetInt("nodeid",-1) %>&siteid=<%=KeRui.Common.PageRequest.GetInt("siteid",-1) %>"
                                target="_blank">编辑</a>
                        </td>
                        <td align="Center">
                            <nobr>
                                <a href="/manage/cms/commentlist.aspx?contentid=<%=model.ContentID %>;return false;">
                                    评论</a><span style="color: gray">(<%=model.CommentCount %>)</span></nobr>
                        </td>
                        <td align="Center" style="<%=deleteShow %>">
                            <a href="javascript:void(0)" onclick="deletecontent(<%=model.ContentID %>);return false;">
                                删除</a>
                        </td>
                        <td align="Center" style="<%=restoreShow %>">
                            <a href="javascript:void(0)" onclick="restorecontent(<%=model.ContentID %>);return false;">
                                还原</a>
                        </td>
                    </tr>
                    <%
                        } %>
                </td>
            </tr>
        </table>
    </div>
    <%if (DataType != "recylebin")
      {
    %>
    <div id="HYC_delete" style="text-align: left; margin-left: 30px;">
        <a href="javascript:void(0)" onclick="checkAll();return false;">全选</a> <a href="javascript:void(0)"
            onclick="checknono();return false;" style="margin-left: 5px; margin-right: 5px;">
            全不选</a> <a href="javascript:void(0)" onclick="checkother();return false;">反选</a>
        <br />
        <input type="button" class="button" value="批量删除" onclick="deleteCheck();" />
        <input type="button" class="button" value="删除此节点下全部内容" onclick="deleteAll();" />
        <input type="button" class="button" value="批量迁移" onclick="moveCheck()" />
        <input type="button" class="button" value="迁移此节点下全部内容" onclick="moveAll()" />
        <input type="button" class="button" value="复制新闻" onclick="copyCheck();" />
    </div>
    <%
        } %>
    <%=PageShow %>
</body>
</html>
